/*
 * @Date: 2020-02-28 16:28:32 
 * 菜单表
 */
const mongoose = require('mongoose')

const { Schema } = mongoose


const SupplySchema = new Schema({
                                                              
    name: { type: String},       //名称 
    path: { type: String}, 
    price: {type: Number},        //价格
    order: {type: Number},        //排序
    contact:{ type: String}, 
    phone: { type: String},
    create_at: { type: Date, default: Date.now, index: -1,select: true },
    update_at: { type: Date, default: Date.now ,select: true},
})


SupplySchema.pre('save', function (next) {
    let now = new Date()
    this.update_at = now
    
    next()
})




mongoose.model('supply', SupplySchema)
module.exports = SupplySchema

